package com.ling.pl.core.hibernate.identifier;

import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.IdentifierGenerator;

import java.io.Serializable;
import java.util.UUID;

//import org.hibernate.engine.spi.SharedSessionContractImplementor;

public class Ling2UUIDGenerator implements IdentifierGenerator {

    public static final String STRATEGY_NAME = "com.ling.pl.core.hibernate.identifier.Ling2UUIDGenerator";

    @Override
    public Serializable generate(SessionImplementor sessionImplementor, Object o) throws HibernateException {
        return UUID.randomUUID().toString();
    }

//    @Override
//    public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException {
//        return UUID.randomUUID().toString();
//    }
}